﻿// Copyright (c) 2014 Takashi Yoshizawa

using System;
using System.Collections.Generic;
using System.Linq;
using SeleniumExcelAddIn.TestCommands;

namespace SeleniumExcelAddIn
{
    public static class TestCommandFactory
    {
        private static readonly Dictionary<string, Type> CommandMappingDefinition = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase)
        {            
//            { "AddLocationStrategy", typeof(AddLocationStrategyCommand) },
//            { "AddLocationStrategyAndWait", typeof(AddLocationStrategyAndWaitCommand) },
//            { "AddScript", typeof(AddScriptCommand) },
//            { "AddScriptAndWait", typeof(AddScriptAndWaitCommand) },
//            { "AddSelection", typeof(AddSelectionCommand) },
//            { "AddSelectionAndWait", typeof(AddSelectionAndWaitCommand) },
//            { "AllowNativeXpath", typeof(AllowNativeXpathCommand) },
//            { "AllowNativeXpathAndWait", typeof(AllowNativeXpathAndWaitCommand) },
//            { "AltKeyDown", typeof(x_AltKeyDownCommand) },
//            { "AltKeyDownAndWait", typeof(x_AltKeyDownAndWaitCommand) },
//            { "AltKeyUp", typeof(x_AltKeyUpCommand) },
//            { "AltKeyUpAndWait", typeof(x_AltKeyUpAndWaitCommand) },
            { "AnswerOnNextPrompt", typeof(AnswerOnNextPromptCommand) },
            { "AssertAlert", typeof(AssertAlertCommand) },
            { "AssertAlertNotPresent", typeof(AssertAlertNotPresentCommand) },
            { "AssertAlertPresent", typeof(AssertAlertPresentCommand) },
//            { "AssertAllButtons", typeof(AssertAllButtonsCommand) },
//            { "AssertAllFields", typeof(AssertAllFieldsCommand) },
//            { "AssertAllLinks", typeof(AssertAllLinksCommand) },
//            { "AssertAllWindowIds", typeof(AssertAllWindowIdsCommand) },
//            { "AssertAllWindowNames", typeof(AssertAllWindowNamesCommand) },
//            { "AssertAllWindowTitles", typeof(AssertAllWindowTitlesCommand) },
            { "AssertAttribute", typeof(AssertAttributeCommand) },
//            { "AssertAttributeFromAllWindows", typeof(AssertAttributeFromAllWindowsCommand) },
            { "AssertBodyText", typeof(AssertBodyTextCommand) },
            { "AssertChecked", typeof(AssertCheckedCommand) },
            { "AssertConfirmation", typeof(AssertConfirmationCommand) },
            { "AssertConfirmationNotPresent", typeof(AssertConfirmationNotPresentCommand) },
            { "AssertConfirmationPresent", typeof(AssertConfirmationPresentCommand) },
            { "AssertCookie", typeof(AssertCookieCommand) },
            { "AssertCookieByName", typeof(AssertCookieByNameCommand) },
            { "AssertCookieNotPresent", typeof(AssertCookieNotPresentCommand) },
            { "AssertCookiePresent", typeof(AssertCookiePresentCommand) },
//            { "AssertCursorPosition", typeof(AssertCursorPositionCommand) },
            { "AssertEditable", typeof(AssertEditableCommand) },
            { "AssertElementHeight", typeof(AssertElementHeightCommand) },
//            { "AssertElementIndex", typeof(AssertElementIndexCommand) },
            { "AssertElementNotPresent", typeof(AssertElementNotPresentCommand) },
            { "AssertElementPositionLeft", typeof(AssertElementPositionLeftCommand) },
            { "AssertElementPositionTop", typeof(AssertElementPositionTopCommand) },
            { "AssertElementPresent", typeof(AssertElementPresentCommand) },
            { "AssertElementWidth", typeof(AssertElementWidthCommand) },
//            { "AssertEval", typeof(AssertEvalCommand) },
//            { "AssertExpression", typeof(AssertExpressionCommand) },
//            { "AssertHtmlSource", typeof(AssertHtmlSourceCommand) },
            { "AssertLocation", typeof(AssertLocationCommand) },
//            { "AssertMouseSpeed", typeof(AssertMouseSpeedCommand) },
            { "AssertNotAlert", typeof(AssertNotAlertCommand) },
//            { "AssertNotAllButtons", typeof(AssertNotAllButtonsCommand) },
//           { "AssertNotAllFields", typeof(AssertNotAllFieldsCommand) },
//            { "AssertNotAllLinks", typeof(AssertNotAllLinksCommand) },
//            { "AssertNotAllWindowIds", typeof(AssertNotAllWindowIdsCommand) },
//            { "AssertNotAllWindowNames", typeof(AssertNotAllWindowNamesCommand) },
//            { "AssertNotAllWindowTitles", typeof(AssertNotAllWindowTitlesCommand) },
            { "AssertNotAttribute", typeof(AssertNotAttributeCommand) },
//            { "AssertNotAttributeFromAllWindows", typeof(AssertNotAttributeFromAllWindowsCommand) },
            { "AssertNotBodyText", typeof(AssertNotBodyTextCommand) },
            { "AssertNotChecked", typeof(AssertNotCheckedCommand) },
            { "AssertNotConfirmation", typeof(AssertNotConfirmationCommand) },
            { "AssertNotCookie", typeof(AssertNotCookieCommand) },
            { "AssertNotCookieByName", typeof(AssertNotCookieByNameCommand) },
//            { "AssertNotCursorPosition", typeof(AssertNotCursorPositionCommand) },
            { "AssertNotEditable", typeof(AssertNotEditableCommand) },
            { "AssertNotElementHeight", typeof(AssertNotElementHeightCommand) },
//            { "AssertNotElementIndex", typeof(AssertNotElementIndexCommand) },
            { "AssertNotElementPositionLeft", typeof(AssertNotElementPositionLeftCommand) },
            { "AssertNotElementPositionTop", typeof(AssertNotElementPositionTopCommand) },
            { "AssertNotElementWidth", typeof(AssertNotElementWidthCommand) },
//            { "AssertNotEval", typeof(AssertNotEvalCommand) },
//            { "AssertNotExpression", typeof(AssertNotExpressionCommand) },
//            { "AssertNotHtmlSource", typeof(AssertNotHtmlSourceCommand) },
            { "AssertNotLocation", typeof(AssertNotLocationCommand) },
//            { "AssertNotMouseSpeed", typeof(AssertNotMouseSpeedCommand) },
//            { "AssertNotOrdered", typeof(AssertNotOrderedCommand) },
            { "AssertNotPrompt", typeof(AssertNotPromptCommand) },
            { "AssertNotSelectOptions", typeof(AssertNotSelectOptionsCommand) },
            { "AssertNotSelectedId", typeof(AssertNotSelectedIdCommand) },
            { "AssertNotSelectedIds", typeof(AssertNotSelectedIdsCommand) },
            { "AssertNotSelectedIndex", typeof(AssertNotSelectedIndexCommand) },
            { "AssertNotSelectedIndexes", typeof(AssertNotSelectedIndexesCommand) },
            { "AssertNotSelectedLabel", typeof(AssertNotSelectedLabelCommand) },
            { "AssertNotSelectedLabels", typeof(AssertNotSelectedLabelsCommand) },
            { "AssertNotSelectedValue", typeof(AssertNotSelectedValueCommand) },
            { "AssertNotSelectedValues", typeof(AssertNotSelectedValuesCommand) },
            { "AssertNotSomethingSelected", typeof(AssertNotSomethingSelectedCommand) },
//            { "AssertNotSpeed", typeof(AssertNotSpeedCommand) },
//            { "AssertNotTable", typeof(AssertNotTableCommand) },
            { "AssertNotText", typeof(AssertNotTextCommand) },
            { "AssertNotTitle", typeof(AssertNotTitleCommand) },
            { "AssertNotValue", typeof(AssertNotValueCommand) },
            { "AssertNotVisible", typeof(AssertNotVisibleCommand) },
//            { "AssertNotWhetherThisFrameMatchFrameExpression", typeof(AssertNotWhetherThisFrameMatchFrameExpressionCommand) },
//            { "AssertNotWhetherThisWindowMatchWindowExpression", typeof(AssertNotWhetherThisWindowMatchWindowExpressionCommand) },
//            { "AssertNotXpathCount", typeof(AssertNotXpathCountCommand) },
//            { "AssertOrdered", typeof(AssertOrderedCommand) },
            { "AssertPrompt", typeof(AssertPromptCommand) },
            { "AssertPromptNotPresent", typeof(AssertPromptNotPresentCommand) },
            { "AssertPromptPresent", typeof(AssertPromptPresentCommand) },
            { "AssertSelectOptions", typeof(AssertSelectOptionsCommand) },
            { "AssertSelectedId", typeof(AssertSelectedIdCommand) },
            { "AssertSelectedIds", typeof(AssertSelectedIdsCommand) },
            { "AssertSelectedIndex", typeof(AssertSelectedIndexCommand) },
            { "AssertSelectedIndexes", typeof(AssertSelectedIndexesCommand) },
            { "AssertSelectedLabel", typeof(AssertSelectedLabelCommand) },
            { "AssertSelectedLabels", typeof(AssertSelectedLabelsCommand) },
            { "AssertSelectedValue", typeof(AssertSelectedValueCommand) },
            { "AssertSelectedValues", typeof(AssertSelectedValuesCommand) },
            { "AssertSomethingSelected", typeof(AssertSomethingSelectedCommand) },
//            { "AssertSpeed", typeof(AssertSpeedCommand) },
//            { "AssertTable", typeof(AssertTableCommand) },
            { "AssertText", typeof(AssertTextCommand) },
            { "AssertTextNotPresent", typeof(AssertTextNotPresentCommand) },
            { "AssertTextPresent", typeof(AssertTextPresentCommand) },
            { "AssertTitle", typeof(AssertTitleCommand) },
            { "AssertValue", typeof(AssertValueCommand) },
            { "AssertVisible", typeof(AssertVisibleCommand) },
//            { "AssertWhetherThisFrameMatchFrameExpression", typeof(AssertWhetherThisFrameMatchFrameExpressionCommand) },
//            { "AssertWhetherThisWindowMatchWindowExpression", typeof(AssertWhetherThisWindowMatchWindowExpressionCommand) },
//            { "AssertXpathCount", typeof(AssertXpathCountCommand) },
//            { "AssignId", typeof(AssignIdCommand) },
//            { "AssignIdAndWait", typeof(AssignIdAndWaitCommand) },
//            { "Break", typeof(BreakCommand) },
            { "CaptureEntirePageScreenshot", typeof(CaptureEntirePageScreenshotCommand) },
            { "CaptureEntirePageScreenshotAndWait", typeof(CaptureEntirePageScreenshotAndWaitCommand) },
            { "Check", typeof(CheckCommand) },
            { "CheckAndWait", typeof(CheckAndWaitCommand) },
            { "ChooseCancelOnNextConfirmation", typeof(ChooseCancelOnNextConfirmationCommand) },
            { "ChooseOkOnNextConfirmation", typeof(ChooseOkOnNextConfirmationCommand) },
            { "ChooseOkOnNextConfirmationAndWait", typeof(ChooseOkOnNextConfirmationAndWaitCommand) },
            { "Click", typeof(ClickCommand) },
            { "ClickAndWait", typeof(ClickAndWaitCommand) },
            { "ClickAt", typeof(ClickAtCommand) },
            { "ClickAtAndWait", typeof(ClickAtAndWaitCommand) },
            { "Close", typeof(CloseCommand) },
            { "ContextMenu", typeof(ContextMenuCommand) },
            { "ContextMenuAndWait", typeof(ContextMenuAndWaitCommand) },
            { "ContextMenuAt", typeof(ContextMenuAtCommand) },
            { "ContextMenuAtAndWait", typeof(ContextMenuAtAndWaitCommand) },
//            { "ControlKeyDown", typeof(ControlKeyDownCommand) },
//            { "ControlKeyDownAndWait", typeof(ControlKeyDownAndWaitCommand) },
//            { "ControlKeyUp", typeof(ControlKeyUpCommand) },
//            { "ControlKeyUpAndWait", typeof(ControlKeyUpAndWaitCommand) },
            { "CreateCookie", typeof(CreateCookieCommand) },
            { "CreateCookieAndWait", typeof(CreateCookieAndWaitCommand) },
            { "DeleteAllVisibleCookies", typeof(DeleteAllVisibleCookiesCommand) },
            { "DeleteAllVisibleCookiesAndWait", typeof(DeleteAllVisibleCookiesAndWaitCommand) },
            { "DeleteCookie", typeof(DeleteCookieCommand) },
            { "DeleteCookieAndWait", typeof(DeleteCookieAndWaitCommand) },
//            { "DeselectPopUp", typeof(DeselectPopUpCommand) },
//            { "DeselectPopUpAndWait", typeof(DeselectPopUpAndWaitCommand) },
            { "DoubleClick", typeof(DoubleClickCommand) },
            { "DoubleClickAndWait", typeof(DoubleClickAndWaitCommand) },
            { "DoubleClickAt", typeof(DoubleClickAtCommand) },
            { "DoubleClickAtAndWait", typeof(DoubleClickAtAndWaitCommand) },
            { "DragAndDrop", typeof(DragAndDropCommand) },
            { "DragAndDropAndWait", typeof(DragAndDropAndWaitCommand) },
            { "DragAndDropToObject", typeof(DragAndDropToObjectCommand) },
            { "DragAndDropToObjectAndWait", typeof(DragAndDropToObjectAndWaitCommand) },
            { "DragDrop", typeof(DragAndDropCommand) },
            { "DragDropAndWait", typeof(DragAndDropAndWaitCommand) },
//            { "FireEvent", typeof(FireEventCommand) },
//            { "FireEventAndWait", typeof(FireEventAndWaitCommand) },
            { "Focus", typeof(FocusCommand) },
            { "FocusAndWait", typeof(FocusAndWaitCommand) },
            { "GoBack", typeof(GoBackCommand) },
            { "GoBackAndWait", typeof(GoBackAndWaitCommand) },
//            { "Highlight", typeof(HighlightCommand) },
//            { "HighlightAndWait", typeof(HighlightAndWaitCommand) },
//            { "IgnoreAttributesWithoutValue", typeof(x_IgnoreAttributesWithoutValueCommand) },
//            { "IgnoreAttributesWithoutValueAndWait", typeof(x_IgnoreAttributesWithoutValueAndWaitCommand) },
//            { "KeyDown", typeof(KeyDownCommand) },
//            { "KeyDownAndWait", typeof(KeyDownAndWaitCommand) },
//            { "KeyPress", typeof(KeyPressCommand) },
//            { "KeyPressAndWait", typeof(KeyPressAndWaitCommand) },
//            { "KeyUp", typeof(KeyUpCommand) },
//            { "KeyUpAndWait", typeof(KeyUpAndWaitCommand) },
//            { "MetaKeyDown", typeof(MetaKeyDownCommand) },
//            { "MetaKeyDownAndWait", typeof(MetaKeyDownAndWaitCommand) },
//            { "MetaKeyUp", typeof(MetaKeyUpCommand) },
//            { "MetaKeyUpAndWait", typeof(MetaKeyUpAndWaitCommand) },
            { "MouseDown", typeof(MouseDownCommand) },
            { "MouseDownAndWait", typeof(MouseDownAndWaitCommand) },
            { "MouseDownAt", typeof(MouseDownAtCommand) },
            { "MouseDownAtAndWait", typeof(MouseDownAtAndWaitCommand) },
//            { "MouseDownRight", typeof(x_MouseDownRightCommand) },
//            { "MouseDownRightAndWait", typeof(x_MouseDownRightAndWaitCommand) },
//            { "MouseDownRightAt", typeof(x_MouseDownRightAtCommand) },
//            { "MouseDownRightAtAndWait", typeof(x_MouseDownRightAtAndWaitCommand) },
            { "MouseMove", typeof(MouseMoveCommand) },
            { "MouseMoveAndWait", typeof(MouseMoveAndWaitCommand) },
            { "MouseMoveAt", typeof(MouseMoveAtCommand) },
            { "MouseMoveAtAndWait", typeof(MouseMoveAtAndWaitCommand) },
//            { "MouseOut", typeof(x_MouseOutCommand) },
//            { "MouseOutAndWait", typeof(x_MouseOutAndWaitCommand) },
//            { "MouseOver", typeof(MouseOverCommand) },
//            { "MouseOverAndWait", typeof(MouseOverAndWaitCommand) },
            { "MouseUp", typeof(MouseUpCommand) },
            { "MouseUpAndWait", typeof(MouseUpAndWaitCommand) },
            { "MouseUpAt", typeof(MouseUpAtCommand) },
            { "MouseUpAtAndWait", typeof(MouseUpAtAndWaitCommand) },
//            { "MouseUpRight", typeof(x_MouseUpRightCommand) },
//            { "MouseUpRightAndWait", typeof(x_MouseUpRightAndWaitCommand) },
//            { "MouseUpRightAt", typeof(x_MouseUpRightAtCommand) },
//            { "MouseUpRightAtAndWait", typeof(x_MouseUpRightAtAndWaitCommand) },
            { "Open", typeof(OpenCommand) },
            { "OpenWindow", typeof(OpenWindowCommand) },
            { "OpenWindowAndWait", typeof(OpenWindowAndWaitCommand) },
            { "Pause", typeof(PauseCommand) },
            { "Refresh", typeof(RefreshCommand) },
            { "RefreshAndWait", typeof(RefreshAndWaitCommand) },
 //           { "RemoveAllSelections", typeof(RemoveAllSelectionsCommand) },
 //           { "RemoveAllSelectionsAndWait", typeof(RemoveAllSelectionsAndWaitCommand) },
 //           { "RemoveScript", typeof(RemoveScriptCommand) },
 //           { "RemoveScriptAndWait", typeof(RemoveScriptAndWaitCommand) },
 //           { "RemoveSelection", typeof(RemoveSelectionCommand) },
 //           { "RemoveSelectionAndWait", typeof(RemoveSelectionAndWaitCommand) },
 //           { "Rollup", typeof(RollupCommand) },
 //           { "RollupAndWait", typeof(RollupAndWaitCommand) },
            { "RunScript", typeof(RunScriptCommand) },
 //           { "RunScriptAndWait", typeof(RunScriptAndWaitCommand) },
            { "Select", typeof(SelectCommand) },
            { "SelectAndWait", typeof(SelectAndWaitCommand) },
            { "SelectFrame", typeof(SelectFrameCommand) },
            { "SelectPopUp", typeof(SelectPopUpCommand) },
            { "SelectPopUpAndWait", typeof(SelectPopUpAndWaitCommand) },
            { "SelectWindow", typeof(SelectWindowCommand) },
            { "SendKeys", typeof(SendKeysCommand) },
 //           { "SetBrowserLogLevel", typeof(SetBrowserLogLevelCommand) },
 //           { "SetBrowserLogLevelAndWait", typeof(SetBrowserLogLevelAndWaitCommand) },
 //           { "SetCursorPosition", typeof(SetCursorPositionCommand) },
 //           { "SetCursorPositionAndWait", typeof(SetCursorPositionAndWaitCommand) },
 //           { "SetMouseSpeed", typeof(SetMouseSpeedCommand) },
 //           { "SetMouseSpeedAndWait", typeof(SetMouseSpeedAndWaitCommand) },
 //           { "SetSpeed", typeof(SetSpeedCommand) },
 //           { "SetSpeedAndWait", typeof(SetSpeedAndWaitCommand) },
            { "SetTimeout", typeof(SetTimeoutCommand) },
//            { "ShiftKeyDown", typeof(ShiftKeyDownCommand) },
//            { "ShiftKeyDownAndWait", typeof(ShiftKeyDownAndWaitCommand) },
//            { "ShiftKeyUp", typeof(ShiftKeyUpCommand) },
//            { "ShiftKeyUpAndWait", typeof(ShiftKeyUpAndWaitCommand) },
            { "Store", typeof(StoreCommand) },
            { "StoreAlert", typeof(StoreAlertCommand) },
//            { "StoreAlertPresent", typeof(StoreAlertPresentCommand) },
//            { "StoreAllButtons", typeof(StoreAllButtonsCommand) },
//            { "StoreAllFields", typeof(StoreAllFieldsCommand) },
//            { "StoreAllLinks", typeof(StoreAllLinksCommand) },
//            { "StoreAllWindowIds", typeof(StoreAllWindowIdsCommand) },
//            { "StoreAllWindowNames", typeof(StoreAllWindowNamesCommand) },
//            { "StoreAllWindowTitles", typeof(StoreAllWindowTitlesCommand) },
            { "StoreAttribute", typeof(StoreAttributeCommand) },
//            { "StoreAttributeFromAllWindows", typeof(StoreAttributeFromAllWindowsCommand) },
            { "StoreBodyText", typeof(StoreBodyTextCommand) },
            { "StoreChecked", typeof(StoreCheckedCommand) },
            { "StoreConfirmation", typeof(StoreConfirmationCommand) },
            { "StoreConfirmationPresent", typeof(StoreConfirmationPresentCommand) },
            { "StoreCookie", typeof(StoreCookieCommand) },
            { "StoreCookieByName", typeof(StoreCookieByNameCommand) },
            { "StoreCookiePresent", typeof(StoreCookiePresentCommand) },
//            { "StoreCursorPosition", typeof(StoreCursorPositionCommand) },
            { "StoreEditable", typeof(StoreEditableCommand) },
            { "StoreElementHeight", typeof(StoreElementHeightCommand) },
//            { "StoreElementIndex", typeof(StoreElementIndexCommand) },
            { "StoreElementPositionLeft", typeof(StoreElementPositionLeftCommand) },
            { "StoreElementPositionTop", typeof(StoreElementPositionTopCommand) },
            { "StoreElementPresent", typeof(StoreElementPresentCommand) },
            { "StoreElementWidth", typeof(StoreElementWidthCommand) },
//            { "StoreEval", typeof(StoreEvalCommand) },
//            { "StoreExpression", typeof(StoreExpressionCommand) },
//            { "StoreHtmlSource", typeof(StoreHtmlSourceCommand) },
            { "StoreLocation", typeof(StoreLocationCommand) },
//            { "StoreMouseSpeed", typeof(StoreMouseSpeedCommand) },
//            { "StoreOrdered", typeof(StoreOrderedCommand) },
            { "StorePrompt", typeof(StorePromptCommand) },
            { "StorePromptPresent", typeof(StorePromptPresentCommand) },
            { "StoreSelectOptions", typeof(StoreSelectOptionsCommand) },
            { "StoreSelectedId", typeof(StoreSelectedIdCommand) },
            { "StoreSelectedIds", typeof(StoreSelectedIdsCommand) },
            { "StoreSelectedIndex", typeof(StoreSelectedIndexCommand) },
            { "StoreSelectedIndexes", typeof(StoreSelectedIndexesCommand) },
            { "StoreSelectedLabel", typeof(StoreSelectedLabelCommand) },
            { "StoreSelectedLabels", typeof(StoreSelectedLabelsCommand) },
            { "StoreSelectedValue", typeof(StoreSelectedValueCommand) },
            { "StoreSelectedValues", typeof(StoreSelectedValuesCommand) },
            { "StoreSomethingSelected", typeof(StoreSomethingSelectedCommand) },
//            { "StoreSpeed", typeof(StoreSpeedCommand) },
//            { "StoreTable", typeof(StoreTableCommand) },
            { "StoreText", typeof(StoreTextCommand) },
            { "StoreTextPresent", typeof(StoreTextPresentCommand) },
            { "StoreTitle", typeof(StoreTitleCommand) },
            { "StoreValue", typeof(StoreValueCommand) },
            { "StoreVisible", typeof(StoreVisibleCommand) },
 //           { "StoreWhetherThisFrameMatchFrameExpression", typeof(StoreWhetherThisFrameMatchFrameExpressionCommand) },
 //           { "StoreWhetherThisWindowMatchWindowExpression", typeof(StoreWhetherThisWindowMatchWindowExpressionCommand) },
 //           { "StoreXpathCount", typeof(StoreXpathCountCommand) },
            { "Submit", typeof(SubmitCommand) },
            { "SubmitAndWait", typeof(SubmitAndWaitCommand) },
            { "Type", typeof(TypeCommand) },
            { "TypeAndWait", typeof(TypeAndWaitCommand) },
            { "TypeKeys", typeof(TypeKeysCommand) },
            { "TypeKeysAndWait", typeof(TypeKeysAndWaitCommand) },
            { "Uncheck", typeof(UncheckCommand) },
            { "UncheckAndWait", typeof(UncheckAndWaitCommand) },
//            { "UseXpathLibrary", typeof(UseXpathLibraryCommand) },
//            { "UseXpathLibraryAndWait", typeof(UseXpathLibraryAndWaitCommand) },
            { "VerifyAlert", typeof(VerifyAlertCommand) },
            { "VerifyAlertNotPresent", typeof(VerifyAlertNotPresentCommand) },
            { "VerifyAlertPresent", typeof(VerifyAlertPresentCommand) },
//            { "VerifyAllButtons", typeof(VerifyAllButtonsCommand) },
//            { "VerifyAllFields", typeof(VerifyAllFieldsCommand) },
//            { "VerifyAllLinks", typeof(VerifyAllLinksCommand) },
//            { "VerifyAllWindowIds", typeof(VerifyAllWindowIdsCommand) },
//            { "VerifyAllWindowNames", typeof(VerifyAllWindowNamesCommand) },
//            { "VerifyAllWindowTitles", typeof(VerifyAllWindowTitlesCommand) },
            { "VerifyAttribute", typeof(VerifyAttributeCommand) },
//            { "VerifyAttributeFromAllWindows", typeof(VerifyAttributeFromAllWindowsCommand) },
            { "VerifyBodyText", typeof(VerifyBodyTextCommand) },
            { "VerifyChecked", typeof(VerifyCheckedCommand) },
            { "VerifyConfirmation", typeof(VerifyConfirmationCommand) },
            { "VerifyConfirmationNotPresent", typeof(VerifyConfirmationNotPresentCommand) },
            { "VerifyConfirmationPresent", typeof(VerifyConfirmationPresentCommand) },
            { "VerifyCookie", typeof(VerifyCookieCommand) },
            { "VerifyCookieByName", typeof(VerifyCookieByNameCommand) },
            { "VerifyCookieNotPresent", typeof(VerifyCookieNotPresentCommand) },
            { "VerifyCookiePresent", typeof(VerifyCookiePresentCommand) },
//            { "VerifyCursorPosition", typeof(VerifyCursorPositionCommand) },
            { "VerifyEditable", typeof(VerifyEditableCommand) },
            { "VerifyElementHeight", typeof(VerifyElementHeightCommand) },
//            { "VerifyElementIndex", typeof(VerifyElementIndexCommand) },
            { "VerifyElementNotPresent", typeof(VerifyElementNotPresentCommand) },
            { "VerifyElementPositionLeft", typeof(VerifyElementPositionLeftCommand) },
            { "VerifyElementPositionTop", typeof(VerifyElementPositionTopCommand) },
            { "VerifyElementPresent", typeof(VerifyElementPresentCommand) },
            { "VerifyElementWidth", typeof(VerifyElementWidthCommand) },
//            { "VerifyEval", typeof(VerifyEvalCommand) },
//            { "VerifyExpression", typeof(VerifyExpressionCommand) },
//            { "VerifyHtmlSource", typeof(VerifyHtmlSourceCommand) },
            { "VerifyLocation", typeof(VerifyLocationCommand) },
//            { "VerifyMouseSpeed", typeof(VerifyMouseSpeedCommand) },
            { "VerifyNotAlert", typeof(VerifyNotAlertCommand) },
//            { "VerifyNotAllButtons", typeof(VerifyNotAllButtonsCommand) },
//            { "VerifyNotAllFields", typeof(VerifyNotAllFieldsCommand) },
//            { "VerifyNotAllLinks", typeof(VerifyNotAllLinksCommand) },
//            { "VerifyNotAllWindowIds", typeof(VerifyNotAllWindowIdsCommand) },
//            { "VerifyNotAllWindowNames", typeof(VerifyNotAllWindowNamesCommand) },
//            { "VerifyNotAllWindowTitles", typeof(VerifyNotAllWindowTitlesCommand) },
            { "VerifyNotAttribute", typeof(VerifyNotAttributeCommand) },
//            { "VerifyNotAttributeFromAllWindows", typeof(VerifyNotAttributeFromAllWindowsCommand) },
            { "VerifyNotBodyText", typeof(VerifyNotBodyTextCommand) },
            { "VerifyNotChecked", typeof(VerifyNotCheckedCommand) },
            { "VerifyNotConfirmation", typeof(VerifyNotConfirmationCommand) },
            { "VerifyNotCookie", typeof(VerifyNotCookieCommand) },
            { "VerifyNotCookieByName", typeof(VerifyNotCookieByNameCommand) },
//            { "VerifyNotCursorPosition", typeof(VerifyNotCursorPositionCommand) },
            { "VerifyNotEditable", typeof(VerifyNotEditableCommand) },
            { "VerifyNotElementHeight", typeof(VerifyNotElementHeightCommand) },
//            { "VerifyNotElementIndex", typeof(VerifyNotElementIndexCommand) },
            { "VerifyNotElementPositionLeft", typeof(VerifyNotElementPositionLeftCommand) },
            { "VerifyNotElementPositionTop", typeof(VerifyNotElementPositionTopCommand) },
            { "VerifyNotElementWidth", typeof(VerifyNotElementWidthCommand) },
//            { "VerifyNotEval", typeof(VerifyNotEvalCommand) },
//            { "VerifyNotExpression", typeof(VerifyNotExpressionCommand) },
//            { "VerifyNotHtmlSource", typeof(VerifyNotHtmlSourceCommand) },
            { "VerifyNotLocation", typeof(VerifyNotLocationCommand) },
//            { "VerifyNotMouseSpeed", typeof(VerifyNotMouseSpeedCommand) },
//            { "VerifyNotOrdered", typeof(VerifyNotOrderedCommand) },
            { "VerifyNotPrompt", typeof(VerifyNotPromptCommand) },
            { "VerifyNotSelectOptions", typeof(VerifyNotSelectOptionsCommand) },
            { "VerifyNotSelectedId", typeof(VerifyNotSelectedIdCommand) },
            { "VerifyNotSelectedIds", typeof(VerifyNotSelectedIdsCommand) },
            { "VerifyNotSelectedIndex", typeof(VerifyNotSelectedIndexCommand) },
            { "VerifyNotSelectedIndexes", typeof(VerifyNotSelectedIndexesCommand) },
            { "VerifyNotSelectedLabel", typeof(VerifyNotSelectedLabelCommand) },
            { "VerifyNotSelectedLabels", typeof(VerifyNotSelectedLabelsCommand) },
            { "VerifyNotSelectedValue", typeof(VerifyNotSelectedValueCommand) },
            { "VerifyNotSelectedValues", typeof(VerifyNotSelectedValuesCommand) },
            { "VerifyNotSomethingSelected", typeof(VerifyNotSomethingSelectedCommand) },
//            { "VerifyNotSpeed", typeof(VerifyNotSpeedCommand) },
//            { "VerifyNotTable", typeof(VerifyNotTableCommand) },
            { "VerifyNotText", typeof(VerifyNotTextCommand) },
            { "VerifyNotTitle", typeof(VerifyNotTitleCommand) },
            { "VerifyNotValue", typeof(VerifyNotValueCommand) },
            { "VerifyNotVisible", typeof(VerifyNotVisibleCommand) },
 //           { "VerifyNotWhetherThisFrameMatchFrameExpression", typeof(VerifyNotWhetherThisFrameMatchFrameExpressionCommand) },
 //           { "VerifyNotWhetherThisWindowMatchWindowExpression", typeof(VerifyNotWhetherThisWindowMatchWindowExpressionCommand) },
 //           { "VerifyNotXpathCount", typeof(VerifyNotXpathCountCommand) },
 //           { "VerifyOrdered", typeof(VerifyOrderedCommand) },
            { "VerifyPrompt", typeof(VerifyPromptCommand) },
            { "VerifyPromptNotPresent", typeof(VerifyPromptNotPresentCommand) },
            { "VerifyPromptPresent", typeof(VerifyPromptPresentCommand) },
            { "VerifySelectOptions", typeof(VerifySelectOptionsCommand) },
            { "VerifySelectedId", typeof(VerifySelectedIdCommand) },
            { "VerifySelectedIds", typeof(VerifySelectedIdsCommand) },
            { "VerifySelectedIndex", typeof(VerifySelectedIndexCommand) },
            { "VerifySelectedLabel", typeof(VerifySelectedLabelCommand) },
            { "VerifySelectedLabels", typeof(VerifySelectedLabelsCommand) },
            { "VerifySelectedValue", typeof(VerifySelectedValueCommand) },
            { "VerifySelectedValues", typeof(VerifySelectedValuesCommand) },
            { "VerifySomethingSelected", typeof(VerifySomethingSelectedCommand) },
 //           { "VerifySpeed", typeof(VerifySpeedCommand) },
 //           { "VerifyTable", typeof(VerifyTableCommand) },
            { "VerifyText", typeof(VerifyTextCommand) },
            { "VerifyTextNotPresent", typeof(VerifyTextNotPresentCommand) },
            { "VerifyTextPresent", typeof(VerifyTextPresentCommand) },
            { "VerifyTitle", typeof(VerifyTitleCommand) },
            { "VerifyValue", typeof(VerifyValueCommand) },
            { "VerifyVisible", typeof(VerifyVisibleCommand) },
//            { "VerifyWhetherThisFrameMatchFrameExpression", typeof(VerifyWhetherThisFrameMatchFrameExpressionCommand) },
//            { "VerifyWhetherThisWindowMatchWindowExpression", typeof(VerifyWhetherThisWindowMatchWindowExpressionCommand) },
//            { "VerifyXpathCount", typeof(VerifyXpathCountCommand) },
            { "WaitForAlert", typeof(WaitForAlertCommand) },
            { "WaitForAlertNotPresent", typeof(WaitForAlertNotPresentCommand) },
            { "WaitForAlertPresent", typeof(WaitForAlertPresentCommand) },
//            { "WaitForAllButtons", typeof(WaitForAllButtonsCommand) },
//            { "WaitForAllFields", typeof(WaitForAllFieldsCommand) },
//            { "WaitForAllLinks", typeof(WaitForAllLinksCommand) },
//            { "WaitForAllWindowIds", typeof(WaitForAllWindowIdsCommand) },
//            { "WaitForAllWindowNames", typeof(WaitForAllWindowNamesCommand) },
//            { "WaitForAllWindowTitles", typeof(WaitForAllWindowTitlesCommand) },
            { "WaitForAttribute", typeof(WaitForAttributeCommand) },
//            { "WaitForAttributeFromAllWindows", typeof(WaitForAttributeFromAllWindowsCommand) },
            { "WaitForBodyText", typeof(WaitForBodyTextCommand) },
            { "WaitForChecked", typeof(WaitForCheckedCommand) },
            //{ "WaitForCondition", typeof(x_WaitForConditionCommand) },
            { "WaitForConfirmation", typeof(WaitForConfirmationCommand) },
            { "WaitForConfirmationNotPresent", typeof(WaitForConfirmationNotPresentCommand) },
            { "WaitForConfirmationPresent", typeof(WaitForConfirmationPresentCommand) },
            { "WaitForCookie", typeof(WaitForCookieCommand) },
            { "WaitForCookieByName", typeof(WaitForCookieByNameCommand) },
            { "WaitForCookieNotPresent", typeof(WaitForCookieNotPresentCommand) },
            { "WaitForCookiePresent", typeof(WaitForCookiePresentCommand) },
//            { "WaitForCursorPosition", typeof(WaitForCursorPositionCommand) },
            { "WaitForEditable", typeof(WaitForEditableCommand) },
            { "WaitForElementHeight", typeof(WaitForElementHeightCommand) },
//            { "WaitForElementIndex", typeof(WaitForElementIndexCommand) },
            { "WaitForElementNotPresent", typeof(WaitForElementNotPresentCommand) },
            { "WaitForElementPositionLeft", typeof(WaitForElementPositionLeftCommand) },
            { "WaitForElementPositionTop", typeof(WaitForElementPositionTopCommand) },
            { "WaitForElementPresent", typeof(WaitForElementPresentCommand) },
            { "WaitForElementWidth", typeof(WaitForElementWidthCommand) },
//            { "WaitForEval", typeof(WaitForEvalCommand) },
//            { "WaitForExpression", typeof(WaitForExpressionCommand) },
            { "WaitForFrameToLoad", typeof(WaitForFrameToLoadCommand) },
//            { "WaitForHtmlSource", typeof(WaitForHtmlSourceCommand) },
            { "WaitForLocation", typeof(WaitForLocationCommand) },
//            { "WaitForMouseSpeed", typeof(WaitForMouseSpeedCommand) },
            { "WaitForNotAlert", typeof(WaitForNotAlertCommand) },
//            { "WaitForNotAllButtons", typeof(WaitForNotAllButtonsCommand) },
//            { "WaitForNotAllFields", typeof(WaitForNotAllFieldsCommand) },
//            { "WaitForNotAllLinks", typeof(WaitForNotAllLinksCommand) },
//            { "WaitForNotAllWindowIds", typeof(WaitForNotAllWindowIdsCommand) },
//            { "WaitForNotAllWindowNames", typeof(WaitForNotAllWindowNamesCommand) },
//            { "WaitForNotAllWindowTitles", typeof(WaitForNotAllWindowTitlesCommand) },
            { "WaitForNotAttribute", typeof(WaitForNotAttributeCommand) },
//            { "WaitForNotAttributeFromAllWindows", typeof(WaitForNotAttributeFromAllWindowsCommand) },
            { "WaitForNotBodyText", typeof(WaitForNotBodyTextCommand) },
            { "WaitForNotChecked", typeof(WaitForNotCheckedCommand) },
            { "WaitForNotConfirmation", typeof(WaitForNotConfirmationCommand) },
            { "WaitForNotCookie", typeof(WaitForNotCookieCommand) },
            { "WaitForNotCookieByName", typeof(WaitForNotCookieByNameCommand) },
//            { "WaitForNotCursorPosition", typeof(WaitForNotCursorPositionCommand) },
            { "WaitForNotEditable", typeof(WaitForNotEditableCommand) },
            { "WaitForNotElementHeight", typeof(WaitForNotElementHeightCommand) },
//            { "WaitForNotElementIndex", typeof(WaitForNotElementIndexCommand) },
            { "WaitForNotElementPositionLeft", typeof(WaitForNotElementPositionLeftCommand) },
            { "WaitForNotElementPositionTop", typeof(WaitForNotElementPositionTopCommand) },
            { "WaitForNotElementWidth", typeof(WaitForNotElementWidthCommand) },
//            { "WaitForNotEval", typeof(WaitForNotEvalCommand) },
//            { "WaitForNotExpression", typeof(WaitForNotExpressionCommand) },
//            { "WaitForNotHtmlSource", typeof(WaitForNotHtmlSourceCommand) },
            { "WaitForNotLocation", typeof(WaitForNotLocationCommand) },
//            { "WaitForNotMouseSpeed", typeof(WaitForNotMouseSpeedCommand) },
//            { "WaitForNotOrdered", typeof(WaitForNotOrderedCommand) },
            { "WaitForNotPrompt", typeof(WaitForNotPromptCommand) },
            { "WaitForNotSelectOptions", typeof(WaitForNotSelectOptionsCommand) },
            { "WaitForNotSelectedId", typeof(WaitForNotSelectedIdCommand) },
            { "WaitForNotSelectedIds", typeof(WaitForNotSelectedIdsCommand) },
            { "WaitForNotSelectedIndex", typeof(WaitForNotSelectedIndexCommand) },
            { "WaitForNotSelectedIndexes", typeof(WaitForNotSelectedIndexesCommand) },
            { "WaitForNotSelectedLabel", typeof(WaitForNotSelectedLabelCommand) },
            { "WaitForNotSelectedLabels", typeof(WaitForNotSelectedLabelsCommand) },
            { "WaitForNotSelectedValue", typeof(WaitForNotSelectedValueCommand) },
            { "WaitForNotSelectedValues", typeof(WaitForNotSelectedValuesCommand) },
            { "WaitForNotSomethingSelected", typeof(WaitForNotSomethingSelectedCommand) },
//            { "WaitForNotSpeed", typeof(WaitForNotSpeedCommand) },
//            { "WaitForNotTable", typeof(WaitForNotTableCommand) },
            { "WaitForNotText", typeof(WaitForNotTextCommand) },
            { "WaitForNotTitle", typeof(WaitForNotTitleCommand) },
            { "WaitForNotValue", typeof(WaitForNotValueCommand) },
            { "WaitForNotVisible", typeof(WaitForNotVisibleCommand) },
//            { "WaitForNotWhetherThisFrameMatchFrameExpression", typeof(WaitForNotWhetherThisFrameMatchFrameExpressionCommand) },
//            { "WaitForNotWhetherThisWindowMatchWindowExpression", typeof(WaitForNotWhetherThisWindowMatchWindowExpressionCommand) },
//            { "WaitForNotXpathCount", typeof(WaitForNotXpathCountCommand) },
//            { "WaitForOrdered", typeof(WaitForOrderedCommand) },
            { "WaitForPageToLoad", typeof(WaitForPageToLoadCommand) },
            //{ "WaitForPopUp", typeof(x_WaitForPopUpCommand) },
            { "WaitForPrompt", typeof(WaitForPromptCommand) },
            { "WaitForPromptNotPresent", typeof(WaitForPromptNotPresentCommand) },
            { "WaitForPromptPresent", typeof(WaitForPromptPresentCommand) },
            { "WaitForSelectOptions", typeof(WaitForSelectOptionsCommand) },
            { "WaitForSelectedId", typeof(WaitForSelectedIdCommand) },
            { "WaitForSelectedIds", typeof(WaitForSelectedIdsCommand) },
            { "WaitForSelectedIndex", typeof(WaitForSelectedIndexCommand) },
            { "WaitForSelectedIndexes", typeof(WaitForSelectedIndexesCommand) },
            { "WaitForSelectedLabel", typeof(WaitForSelectedLabelCommand) },
            { "WaitForSelectedLabels", typeof(WaitForSelectedLabelsCommand) },
            { "WaitForSelectedValue", typeof(WaitForSelectedValueCommand) },
            { "WaitForSelectedValues", typeof(WaitForSelectedValuesCommand) },
            { "WaitForSomethingSelected", typeof(WaitForSomethingSelectedCommand) },
//            { "WaitForSpeed", typeof(WaitForSpeedCommand) },
//            { "WaitForTable", typeof(WaitForTableCommand) },
            { "WaitForText", typeof(WaitForTextCommand) },
            { "WaitForTextNotPresent", typeof(WaitForTextNotPresentCommand) },
            { "WaitForTextPresent", typeof(WaitForTextPresentCommand) },
            { "WaitForTitle", typeof(WaitForTitleCommand) },
            { "WaitForValue", typeof(WaitForValueCommand) },
            { "WaitForVisible", typeof(WaitForVisibleCommand) },
//            { "WaitForWhetherThisFrameMatchFrameExpression", typeof(WaitForWhetherThisFrameMatchFrameExpressionCommand) },
//            { "WaitForWhetherThisWindowMatchWindowExpression", typeof(WaitForWhetherThisWindowMatchWindowExpressionCommand) },
//            { "WaitForXpathCount", typeof(WaitForXpathCountCommand) },
            //{ "WindowFocus", typeof(WindowFocusCommand) },
            //{ "WindowFocusAndWait", typeof(WindowFocusAndWaitCommand) },
            { "WindowMaximize", typeof(WindowMaximizeCommand) },
            { "WindowMaximizeAndWait", typeof(WindowMaximizeAndWaitCommand) },

#region Custom
            { "GoForward", typeof(GoForwardCommand) },
            { "GoForwardAndWait", typeof(GoForwardAndWaitCommand) },
            { "Vba", typeof(VbaCommand) },
#endregion

#region Flow Control
            { "Echo", typeof(EchoCommand) },
//            { "EndWhile", typeof(EndWhileCommand) },
//            { "GotoIf", typeof(GotoIfCommand) },
//            { "GotoLabel", typeof(GotoLabelCommand) },
//            { "Label", typeof(LabelCommand) },
//            { "While", typeof(WhileCommand) },

#endregion
        };

        private static readonly Dictionary<string, ITestCommand> CommandInstanceCache = new Dictionary<string, ITestCommand>(StringComparer.OrdinalIgnoreCase);

        public static IEnumerable<string> GetCommandNames()
        {
            var list = CommandMappingDefinition.Keys.Select(i => i.Substring(0, 1).ToLower() + i.Substring(1)).ToList();
            list.Sort();

            return list;
        }

        public static ITestCommand CreateCommand(string commandName)
        {
            if (string.IsNullOrWhiteSpace(commandName))
            {
                return null;
            }

            if (commandName.StartsWith("#", StringComparison.Ordinal))
            {
                return null;
            }

            if (CommandInstanceCache.ContainsKey(commandName))
            {
                return CommandInstanceCache[commandName];
            }

            if (!CommandMappingDefinition.ContainsKey(commandName))
            {
                throw new InvalidOperationException(Properties.Resources.NoSuchCommand);
            }

            Type type = CommandMappingDefinition[commandName];
            ITestCommand command = (ITestCommand)Activator.CreateInstance(type);
            CommandInstanceCache.Add(commandName, command);

            return command;
        }
    }
}
